#pragma once
#include "xstring.h"
#include "xFontMgr.h"

class xButton : public xControl
{
public:
	xButton();
	~xButton();
private:
	xEvent		m_fnClick;//ON_BTN_CLICK, XEVENT_BTN_CLICK, void OnClick(xControl &sender);
	xString		m_strText;
	xRectF		m_rect;
	xFontMgr	m_xFontMgr;
	xFont		*m_pFont;
	xBrush		*m_pFontBrush;
	BOOL		m_bLButtonDown;
protected:
	virtual	void OnDraw();
	virtual void OnLButtonDown(UINT nFlags, POINT point); 
	virtual void OnLButtonUp(UINT nFlags, POINT point); 
	virtual void OnMouseEnter();
	virtual void OnMouseLeave();
public:
	virtual void Delegate(DWORD dwEvent, xFrame *pFrame, FnEvent fnEvent);
	virtual void Reset(ID2D1RenderTarget *pRenderTarget, BOOL bReleaseOnly);
public:
	void	Create(const RECT &rect, ID2D1RenderTarget *pRenderTarget, LPCWSTR swText = NULL);
	LPCWSTR	GetText();
	void	SetText(LPCWSTR szText);
};
